<?
$class_menu	= new menu();
$listAll	= $class_menu->getAllChild("menus", "mnu_id", "mnu_parent_id", 0, "mnu_type = 1 AND mnu_active = 1 AND lang_id = " . $lang_id, "mnu_id,mnu_name,mnu_type,mnu_link,mnu_target", "mnu_order ASC,mnu_name ASC", "mnu_has_child", 0);
unset($class_menu);
$count = count($listAll);
?>
<ul class="header_menu header_menu_multi" style="z-index:999">
	<li class="first"></li>
    <?
	$current_level = 0;
    for ($i=0;$i<$count;$i++)
	{
		if ($current_level == 0)
		{
			$li_class = ' class="root normal"';
			$a_class = '';
		}
		else
		{
			$li_class = '';
			if ($current_level < $listAll[$i+1]['level'])
			{
				$a_class = 'has_child';
			}
			else
			{
				$a_class = '';
			}
		}
	?>
    	<li<?=$li_class?>><a href="<?=$listAll[$i]['mnu_link']?>" target="<?=$listAll[$i]['mnu_target']?>"><? if ($current_level == 0) {?><span><b lang="<?=$array_lang[$lang_id][0]?>"><?=$listAll[$i]['mnu_name']?></b></span><? } else {?><?=$listAll[$i]['mnu_name']?><? }?></a>
    <?
		if ($current_level == $listAll[$i+1]['level'])
		{
			echo '</li>';
		}
		elseif ($current_level < $listAll[$i+1]['level'])
		{
			echo '<ul>';
			$current_level = $listAll[$i+1]['level'];
		}
		else
		{
			while ($current_level > $listAll[$i+1]['level'])
			{
				echo '</li></ul>';
				--$current_level;
			}
		}
	}
	?>
    <li class="last"></li>
    <style type="text/css">
		.header_menu .flag_vn{
		background:url(<?=$gs_imagepath?>icon_flag_vn.gif) no-repeat;
		font-weight:bold;
		height:24px;
		margin-top:3px;
		padding:3px 14px 0px 28px;
		float:right;
		color:#FFFF00;
	}
	.header_menu .flag_en{
		background:url(<?=$gs_imagepath?>icon_flag_en.gif) no-repeat;
		font-weight:bold;
		height:24px;
		margin-top:3px;
		padding:3px 14px 0px 28px;
		float:right;
		color:#FFFF00;
	}
	</style>
    <?php
	for ($i=1;$i<=2;$i++)
	{
		if ($i <> $lang_id)
		{
	?>
	<li class="flag_<?=$array_lang[$i][0];?>" onclick="window.location.href='<?=$con_root_path;?>change_lang.php?lang_id=<?=$i;?>'" title="<?=$array_lang[$i][1];?>"><?=$array_lang[$i][1];?></li>
	<?php
		}
	}
	?>
</ul>
<div class="clear"></div>
<script type="text/javascript">$(function(){$(".header_menu_multi li").hover(function(){$(this).addClass("hover");ob= $("ul:first", this);ob.css("visibility", "visible");temp= ($(window).width() - 1000) / 2;if(temp < 0) temp = 0;offsetLeft= 1000 - (ob.offset().left - temp);if(offsetLeft < ob.outerWidth(true)){if(ob.parent().find("a:first").hasClass("has_child")) ob.css("left", "-100%");else ob.css("left", (offsetLeft - ob.outerWidth(true)) + "px");}},function(){$(this).removeClass("hover");$("ul:first", this).css("visibility", "hidden");});$(".header_menu_multi li ul li:has(ul)").find("a:first").addClass("has_child");if(isIE6 || isIE7) $(".header_menu_multi li ul li").css("margin-bottom", "-3px");});</script>